package com.hkbigdata.springbootdruid.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author liuanbo
 * @creat 2024-10-29-18:07
 * @see 2194550857@qq.com
 */
@RestController
public class QueryController {
    @Autowired
    JdbcTemplate jdbcTemplate;

    @GetMapping("/query")
    public Map<String, Object> query() {
        String sql = "select * from department";
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        return maps.get(0);
    }

}
